<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html
        PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
      xml:lang="en" lang="en">
<title>查看课程</title>

<h:head>
    <script type="text/javascript">
        $(document).ready(function () {
            //第一次进入页面刷新一次，仅一次
            //location.href.indexOf("#")获取当前页面地址并在其中查找"#"首次出现位置，找不到就是-1
            if (location.href.indexOf("#") == -1) {
                //在当前页面地址加入"#"，使下次不再进入此判断
                location.href = location.href + "#";
                location.reload();
            }
        })
    </script>
    <link href="../../css/bootstrap.min.css" rel="stylesheet"/>
    <link href="../../css/font-awesome.css" rel="stylesheet"/>

    <!-- Data Tables -->
    <link href="../../css/style.css" rel="stylesheet"/>
    <!-- Sweet Alert -->
    <link href="../../css/plugins/sweetalert/sweetalert.css" rel="stylesheet"/>

    <link href="../../css/animate.css" rel="stylesheet"/>
    <link href="../../css/style.css?v=4.1.0" rel="stylesheet"/>
    <!-- Data Tables -->
    <link href="../../css/style.css" rel="stylesheet"/>
    <style type="text/css">
        table, th {
            font-size: 15px;
            text-align: center;
            min-width: 150px;
        }
    </style>
</h:head>

<h:body class="gray-bg">
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-content">
                        <h:form>
                            <h:dataTable value="#{course.coursesList}" var="cour"
                                         cellspacing="0" cellpadding="10px" rules="all" border="4" frame="border"
                                         width="100%" class="table table-striped table-bordered table-hover dataTable">
                                <h:column>
                                    <f:facet name="header">编号</f:facet>
                                    <h:outputText value="#{cour.id}"/>
                                </h:column>
                                <h:column>
                                    <f:facet name="header">名称</f:facet>
                                    <h:outputText value="#{cour.name}"/>
                                </h:column>
                                <h:column>
                                    <f:facet name="header">学分</f:facet>
                                    <h:outputText value="#{cour.credit}"/>
                                </h:column>
                                <h:column>
                                    <f:facet name="header">名额</f:facet>
                                    <h:outputText value="#{cour.quota}"/>
                                </h:column>
                                <h:column>
                                    <f:facet name="header">任课教师</f:facet>
                                    <h:outputText value="#{cour.teacher}"/>
                                </h:column>
                                <h:column>
                                    <f:facet name="header">类别</f:facet>
                                    <h:outputText value="#{cour.category}"/>
                                </h:column>
                                <h:column>
                                    <f:facet name="header">时间</f:facet>
                                    <h:outputText value="#{cour.time}"/>
                                </h:column>
                                <h:column>
                                    <f:facet name="header">周次</f:facet>
                                    <h:outputText value="#{cour.week}"/>
                                </h:column>
                                <h:column>
                                    <f:facet name="header">上课地点</f:facet>
                                    <h:outputText value="#{cour.address}"/>
                                </h:column>
                                <h:column>
                                    <f:facet name="header">操作</f:facet>
                                    <h:commandButton class="btn btn-danger"
                                                     action="#{course.deleteCourseById(cour.id)}" value="删除"/>
                                    <h:commandButton class="btn btn-primary" action="#{course.goToModifyCourse(cour.id)}"
                                                     style="margin-left: 10px" value="编辑"/>
                                </h:column>
                            </h:dataTable>
                           <!-- <div id="paging" style="text-align: right;padding-right: 20px;margin-top: 20px">
                                <h:commandButton action="#{course.paging('first')}" value="首页"/>　
                                <h:commandButton action="#{course.paging('previous')}" value="上一页"/>　
                                第 <h:outputLabel value="#{course.pageNumber + 1}"/> 页　
                                <h:commandButton action="#{course.paging('next')}" value="下一页"/>　
                                <h:commandButton action="#{course.paging('last')}" value="尾页"/>
                            </div>-->
                        </h:form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <!-- 全局js -->
    <script type="text/javascript" src="../../js/jquery.min.js"></script>
    <script type="text/javascript" src="../../js/bootstrap.min.js"></script>
    <!-- iCheck -->
    <script type="text/javascript" src="../../js/plugins/iCheck/icheck.min.js"></script>
    <script type="text/javascript" src="../../js/plugins/dataTables/jquery.dataTables.js"></script>
    <script type="text/javascript" src="../../js/plugins/dataTables/dataTables.bootstrap.js"></script>
    <!-- Page-Level Scripts -->
    <script type="text/javascript">
        $(document).ready(function () {
            $('.dataTable').dataTable();
        });
    </script>
</h:body>

</html>